package com.slofzx.nuoda.evaluation.project.enums;

import com.slofzx.nuoda.common.EnumConfig;
import com.slofzx.nuoda.common.config.Type;

/**
 * 状态枚举
 * mayy
 */
@EnumConfig(id="project-state",name = "状态")
public enum ProjectStateEnum implements Type {
    /**
     * 报告
     */
    REPORT("report","待上报",1),
    /**
     * 待审核
     */
    AUDIT("audit","待审核",2),
    /**
     * 完成
     */
    COMPLETE("complete","已完成",3);
    /**
     * 数据类型id
     */
    private String id;
    /**
     * 数据类型展示名称
     */
    private String name;
    /**
     * 排序值
     */
    private double sort;

    ProjectStateEnum(String id, String name,double sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    @Override
    public String getId() {
        return id;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public double getSort() {
        return sort;
    }

    /**
     * 根据id获取对应的枚举
     * @param id 枚举值的标识
     * @return
     */
    public static ProjectStateEnum getEnum(String id){
        for(ProjectStateEnum dataTypeEnum: ProjectStateEnum.values()){
            if(dataTypeEnum.getId().equals(id)){
                return dataTypeEnum;
            }
        }
        return null;
    }
}
